<template>
	<view class="list-item-wrap" :class="changeType">
		<view class="item-header">
			<text>{{title}}</text>
		</view>
		<view class="item-footer">
			<text>{{amountMemo}}</text>
		</view>
	</view>
</template>

<script lang="ts" setup>
	import { computed } from 'vue';
	import { ChangeType } from '../utils/enum';
	const { title, changeType, amount } = defineProps<{
		changeType : 'expend' | 'income';
		title : string;
		amount : number;
	}>()
	const amountMemo = computed(() => {
		return ChangeType[changeType] + amount;
	})
</script>

<style lang="scss" scoped>
	.list-item-wrap {
		width: 100%;
		height: 100%;
		color: #ffffff;
		box-sizing: border-box;
		display: flex;
		flex-direction: row;
		align-items: center;
		padding: 0 15px;
		border: 1px solid rgba(0, 0, 0, 0.8);
		border-radius: 4px;

		&.expend {
			background-color: rgba(253, 224, 71, 0.8);
		}

		&.income {
			background-color: rgba(163, 230, 53, 0.8);
		}

		.item-header {
			flex: 1;
			font-size: 14px;
		}

		.item-footer {
			font-size: 12px;
		}

	}
</style>